Skip to content

feat: allow import of newer pocket data export files in csv format#1023

Merged
fmartingr merged 5 commits intogo-shiori:masterfrom
melnary:feat/pocket-csv-import
Dec 11, 2024
Merged

feat: allow import of newer pocket data export files in csv format#1023
fmartingr merged 5 commits intogo-shiori:masterfrom
melnary:feat/pocket-csv-import

Conversation

@melnary
Copy link
Copy Markdown
Contributor

@melnary melnary commented Dec 9, 2024

Recently Pocket changed the format of their data export function, switching from HTML files to a zipped folder containing CSV files, delivered in parts of up to 10000 bookmarks.
Other bookmark managers were also affected by this, as seen here: karakeep-app/karakeep#570

This patch allows the pocket sub-command to handle these files correctly, expanding it's functionality to import both HTML and CSV files, as I believe the ability to import older exports may still be useful. This is done by a simple file extension check, which I think will suffice for most users.

Note that the command still does not process the multiple part files explicitly, so the user has to import them one by one, which I don't think will be too much of a hassle for the user either way. :)

I would appreciate it if someone could test this patch on an older HTML file (or give me one so I could test it myself :3), as I was only able to test it with my own CSV export.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 103 lines in your changes missing coverage. Please review.

Project coverage is 34.28%. Comparing base (87bc7a8) to head (2e5290a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/cmd/pocket.go 0.00% 103 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1023      +/-   ##
==========================================
- Coverage   34.71%   34.28%   -0.44%     
==========================================
  Files          61       61              
  Lines        5326     5393      +67     
==========================================
  Hits         1849     1849              
- Misses       3253     3320      +67     
  Partials      224      224              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fmartingr
Copy link
Copy Markdown
Member

Hey @melnary, thanks for the contribution! I'm not super famiiar with pocket and their exports so for me if you tested it it's good to go. Can you take a look at the CI errors and correct them though?

@melnary
Copy link
Copy Markdown
Contributor Author

melnary commented Dec 11, 2024

@fmartingr Hi! I was wondering where the CI was at :3
Do we have something to address coverage in the cmd package?

@fmartingr
Copy link
Copy Markdown
Member

Dont worry about coverage, the linter errors are here: https://github.com/go-shiori/shiori/actions/runs/12276136781/job/34257042686#step:3:1

@melnary
Copy link
Copy Markdown
Contributor Author

melnary commented Dec 11, 2024

@fmartingr Please approve the workflows again, my local linter is reporting no errors, should be good to go!

@melnary
Copy link
Copy Markdown
Contributor Author

melnary commented Dec 11, 2024

Ah and one more thing! I did manage to track down an older HTML export file, to make sure that I didn't end up breaking the HTML import feature, luckily it all still works smoothly!

@fmartingr
Copy link
Copy Markdown
Member

Ah and one more thing! I did manage to track down an older HTML export file, to make sure that I didn't end up breaking the HTML import feature, luckily it all still works smoothly!

That's awesome!

Copy link
Copy Markdown
Member

@fmartingr fmartingr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@fmartingr fmartingr merged commit c2821ff into go-shiori:master Dec 11, 2024
@Panphico
Copy link
Copy Markdown

Panphico commented Apr 6, 2025

Hi, thank you all for the patch. However, this patch use a mandatory "cursor" field (Invalid CSV format. Header must be: title,url,time_added,cursor,tags,status) that is not in my pocket extract. Could you make this field optional please ?

@wunderkind2k1
Copy link
Copy Markdown

Hey @Panphico - just wanted to let you know how you can have a workaround for your problem (solved is just seconds ago on my own). You can just import your pocket .csv file into a spreadsheet app and add an empty column "cursor" at the right position. After that you export that file as .csv file and this can be imported by shiori. I managed to get my roughly 3000 bookmarks imported this way. If you are on a mac and try this with numbers - you might run into trouble as numbers uses ";" as seperator and shiori doesn't like that. Long story short: Use something else (I used google sheets). Hope this helps. Have a nice one.

@Panphico
Copy link
Copy Markdown

Panphico commented May 27, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants